#include "Stdafx.h"
#include "Direct3DTexture9.h"
#include "Direct3DSurface9.h"

using namespace Vortex::Wrapper::Direct3D;

Direct3DTexture9::Direct3DTexture9(IDirect3DTexture9* handle) : _handle(handle) {

}

Direct3DTexture9::~Direct3DTexture9() {
	_handle->Release();
}

HResult Direct3DTexture9::GetSurfaceLevel(UINT level, [Out] Direct3DSurface9^% result) {
	result = nullptr;
	IDirect3DSurface9* levelSurface;

	HResult retValue = HResult(_handle->GetSurfaceLevel(level, &levelSurface));
	if (retValue.IsSuccess) {
		result = gcnew Direct3DSurface9(levelSurface);
	}

	return retValue;
}